from LeetCoder import *


class Solution:

    def longestSemiRepetitiveSubstring(self, s: str) -> int:
        ans = 1
        a = b = 0
        for i in range(1, len(s)):
            if s[i] == s[i - 1]:
                a = b
                b = i
            ans = max(ans, i - a + 1)
        return ans
s = Solution()
print(s.longestSemiRepetitiveSubstring("0"))
